<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>编辑</title>
		<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" />
		<link href="../../kitAdmin/css/app.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="../../plugins/select2/dist/css/select2.min.css"/>
		<style type="text/css">
			.slt{
				width: 240px !important;
			}
		</style>
	</head>

	<body>
		<div class='kit-table'>
			<div style='margin:10px'>
				
		<form class='layui-form' action='' lay-filter='form-edit'>
			<input type='hidden' name='uniqueid'  data-link='{:uniqueid}' />
			<div class='layui-form-item'>
				
				
				<div class='layui-inline'>
					<label class="layui-form-label" >入职</label>
				    <div class="layui-input-block">
				      <input type="checkbox"lay-filter="state" id='state' name='state' lay-skin="switch"  lay-text="入职|离职">
				    </div>
				</div>
				<div class='layui-inline'>
					<label class="layui-form-label">显示</label>
				    <div class="layui-input-block">
				      <input type="checkbox" lay-filter="isDelete" name="isDelete" id="isDelete" lay-skin="switch"  lay-text="显示|隐藏">
				    </div>
				</div>
				<div class='layui-inline'>
					<label class="layui-form-label">置顶</label>
				    <div class="layui-input-block">
				      <input type="checkbox" name="setTop"lay-filter="setTop" id="setTop" lay-skin="switch" lay-text="置顶|正常">
				    </div>
				</div>
			</div>
		</form>
			</div>
		</div>
		<script src="../../common/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../static/js/base.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/jsviews/jsviews.js" type="text/javascript"></script>
		<script src="../../plugins/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/select2/dist/js/select2.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var uid = getQueryVariable('uniqueid');
			var obj={};
			jQuery(document).ready(function() {
				bindFormData();
			});
			var callback_save=function(){
				obj.uniqueid=uid;
				return obj;
			}
			function bindFormData(){
				if(uid){
					$.ajax({
						url:baseUrl+'/teachers/'+uid,
						type:'get',
						success:function(data){
							data=data.data;
							obj.state=data.state;
							obj.isDelete=data.isDelete;
							obj.setTop=data.setTop;
							$('#state').attr("checked",data.state==0);
							$('#isDelete').attr("checked",data.isDelete==0);
							$('#setTop').attr("checked",data.setTop==1);
							layui.form.render();
						},
						error:function(){
							parent.layer.alert('数据加载失败，系统或网络错误！');
						}
					});
				}
			}
			layui.use('form', function(){
			  var form = layui.form;
			  
			  //监听提交
			    form.on('switch(state)', function(data){
					obj.state=this.checked ? 0 : 1;
					obj.status=this.checked ? '在职' : '离职';
				});
				 form.on('switch(isDelete)', function(data){
					obj.isDelete=this.checked ? 0 : 1;
//				obj.isDelete=$('#isDelete').val();
				}); 
				 form.on('switch(setTop)', function(data){
				 	
					obj.setTop=this.checked ? 1 : 0;
				}); 
			});
		</script>
	</body>

</html>
